"""
1 打印输出，年龄大于20岁的人员名单；
2 向列表中新增数据；
3 统计男生和女生的人数；
"""

with open('4.json', mode='r', encoding='utf-8') as f:
    data = eval(f.read())

# print(data)
# 1
for i in data:
    if i['age'] > 20:
        print(i['name'])

# 2
data.append({'name': 'Dream', 'age': 23, 'genda': '男'})
print(data)

# 3
male = 0
female = 0
for i in data:
    if i['genda'] == '男':
        male+=1
    else:
        female += 1

print(male, female)